Skip to content

Pin how the two environment variables combine, and what disabled() says - #48

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/pin-environment-opt-out-edges
Nov 14, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/pin-environment-opt-out-edges

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle. Three characterization tests are added to TraceClientTest for environment opt-out behaviour that no existing test drove. Production code is not changed.

  • environment_eitherVariableAloneTurnsReportingOffWhateverTheOtherSays: a TRACE_USAGE_REPORTING opt-out is not cancelled by a non-opt-out DO_NOT_TRACK, and the reverse also holds. This pins the || in environmentDisables(). The previous tests only ever set one variable that opts out, or two that both leave reporting on. DO_NOT_TRACK=" Yes " is also covered, so trimming is now pinned for that variable as well as for TRACE_USAGE_REPORTING.
  • environment_valuesThatAreNotAnOptOutLeaveReportingOn: blank, whitespace-only, opposite-word and unlisted values (disabled, offline, 2, y) of each variable leave the client enabled. This matches the README "Opting out" row, which lists only the spellings isOff / isYes accept.
  • disabled_isOffForTheConfigReasonUnlessTheEnvironmentSaysSoFirst: TraceClient.disabled() reports REASON_CONFIG and has no install ID. Because the environment is checked first, it reports REASON_ENVIRONMENT when DO_NOT_TRACK=1. Until now only isEnabled() was asserted for this factory.

No tracking issue: these gaps were found during triage by comparing environmentDisables(), isOff, isYes and disabled() against the test file.

Test plan

  • mvn -B verify locally on JDK 21: Tests run: 116, Failures: 0, Errors: 0, Skipped: 0
  • CI matrix build (8), build (17), build (21) green on the PR head

Open issues not picked this cycle

Each open issue needs a maintainer decision, so the cycle was spent on tests instead:

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

Either variable opting out turns reporting off whatever the other says;
blank and unlisted values leave it on; DO_NOT_TRACK is trimmed; and
TraceClient.disabled() gives the config reason unless the environment
already opted out. Tests only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (Phase 4, scored against CI run 43548326272 and the diff):

  • Scope: PASS. git diff --stat origin/main shows one file, TraceClientTest.java, +80/-0. No production, docs or build files are touched.
  • Tests-new: PASS (not applicable). No public method is added. The three new tests exercise existing public surface: disabled(), disabledReason(), installId() and isEnabled().
  • Tests-fix: PASS (not applicable). Nothing is fixed. These are characterization tests of current behaviour, and all of them passed against unchanged production code.
  • Sibling structure: PASS. The tests follow subject_behaviourInPlainWords naming with // Arrange / // Act / // Assert. They use the environment seam and use TraceClient.REASON_* constants as disabledReason_followsThePrecedence... does. They sit next to environment_disablesAndWinsOverTheServerWideFile.
  • Sibling renames: PASS (not applicable). Nothing is renamed.
  • Docs: PASS. The behaviour pinned matches the README "Opting out" environment row and the class Javadoc at TraceClient.java:73-74. No doc change is needed.
  • Issue resolution: PASS (not applicable). There is no Closes, and the PR body says the gaps were found during triage.
  • CI: PASS. build (8), build (17) and build (21) are all green on the head.
  • No dependencies / Single file / Java 8: PASS. pom.xml is unchanged. git ls-files src/main lists only TraceClient.java. The new test code uses only Java 8 constructs (array literals, no var or List.of), and the build (8) leg is green.
  • Never throws / Non-blocking / Environment seam / Version / Opt-out contract: PASS (not applicable). src/main is unchanged.

Judgment note: TraceClientTest.java:1201 (new). The enabled clients in environment_valuesThatAreNotAnOptOutLeaveReportingOn are closed. The clients in environment_eitherVariableAloneTurnsReportingOffWhateverTheOtherSays are all disabled and own no thread, so no close() is needed there. This matches disabledClient_saysWhy.

The local mvn -B verify on JDK 21 ran 116 tests with 0 failures, and so did CI on all three JDKs. This is a tests-only PR with no do-not-auto-merge path touched.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit fa37ec7 into main Nov 14, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/pin-environment-opt-out-edges branch November 14, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant